#!/bin/bash

#rm -rf  ~/.local/share/nvim/site/pack/packer
#cp -rf packer ~/.local/share/nvim/site/pack/packer

#npm install eslint -g
# for telescope
#apt install -y fd-find
#apt install -y ripgrep


#LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep '"tag_name":' |  sed -E 's/.*"v*([^"]+)".*/\1/')
#curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
#sudo tar xf lazygit.tar.gz -C /usr/local/bin lazygit

#go install github.com/jesseduffield/lazygit@latest

if command -v fdfind > /dev/null 2>&1; then
    echo 'check fdfind ok'
else
    apt install -y fd-find
fi


if command -v rgrep > /dev/null 2>&1; then
    echo 'check ripgrep ok'
else
    apt install -y ripgrep
fi

if command -v npm > /dev/null 2>&1; then
    echo 'check npm ok'
    r=`npm ls -g --depth 0 eslint`
    if [[ $r == .*(empty).* ]]; then
        sudo npm install eslint -g
    else
        echo 'check npm eslint'
    fi
fi


# update nvim

# if [ ! -d /usr/local/nvim ]
# then
#     echo 'afaf'
# fi
